import React, { Component } from 'react';
import {UserList} from '../../components';
import {userAction} from '../../actions';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import { Link } from 'react-router-dom';
import { userService } from '../../service'




class User extends Component {

    constructor (props) {
        super(props)
    }

    // componentDidMount() {
    //     console.log(this.props);
    //     console.log("---------------------------------");
    //     const {selUser} = this.props.actions;
    //     //渲染后加载service查询方法
    //     userService.selUserAll(null,selUser);
    // }


    render() {
        console.log("-----------渲染用props----------")
        console.log(UserList);
        return (
            <div>
                <Link to="/dept"><button>dept</button></Link><Link to="/user"><button>user</button></Link>
                {/* <UserList actions = {this.props.actions} users = {this.props.userData.userList} /> */}
                <UserList />
            </div>
        )
    }
    
}

//连接state到props
// const mapStateToProps = state => {
//     console.log("hhhhhhhhhhhhhhhhhhhhhh");
//     console.log(state);
//     return{
//         userData: state.userReducer
//     }
// }

// const mapDispatchToProps = (dispatch) =>{
//     console.log(userAction);
//     return{
//         actions:bindActionCreators(userAction,dispatch),
//         dispatch:dispatch
//     }
// }


// export default connect(
//     mapStateToProps,mapDispatchToProps
// )(User);

export default User;